package screens 
{
	import com.greensock.plugins.TintPlugin;
	import feathers.controls.ScrollContainer;
	import feathers.controls.text.StageTextTextEditor;
	import feathers.controls.TextInput;
	import feathers.layout.HorizontalLayout;
	import feathers.layout.VerticalLayout;
	import Loadtext.LoadText;
	import flash.display.Bitmap;
	import flash.display.Graphics;
	import flash.display.Loader;
	import flash.display.Shape;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import objects.Bartrack;
	import objects.BaseBuild;
	import objects.BaseBuild;
	import objects.Canon;
	import objects.Enemy;
	import objects.LoadEnemy;
	import objects.MyObject;
	import objects.Path;
	import objects.Solider;
	import objects.SoliderChinese;
	import objects.TestAnimation;
	import objects.Tower;
	import objects.updateStarListItem;
	import starling.animation.DelayedCall;
	import starling.display.Button;
	import starling.display.Image;
	import starling.display.MovieClip;
	import starling.display.Quad;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.events.Touch;
	import starling.events.TouchEvent;
	import starling.events.TouchPhase;
	import starling.filters.BlurFilter;
	import starling.filters.ColorMatrixFilter;
	import starling.text.TextField;
	import starling.textures.Texture;
	import starling.utils.VAlign;
	import starling.utils.HAlign;
	import Assets;
	import objects.ManagerObject;
	import objects.ManagerEffect;
	import objects.Road;
	/**
	 * ...
	 * @author Tuan
	 */
	public class Login extends Sprite
	{
		public var m_background:Image;
		public var m_text_User:TextInput;
		public var m_pass_User:TextInput;
		public var m_button_Login:Button;
		public var m_text_Text_User:TextField;
		public var m_text_Pass_User:TextField;
		public function Login() 
		{
			this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
			this.addEventListener(starling.events.Event.ENTER_FRAME, update);
			this.addEventListener(TouchEvent.TOUCH, onTouch);
			super();	
			
		}
		private function onTouch(e:TouchEvent):void
		{
			var touch:Touch = e.getTouch(stage);
			if (touch)
			{
				
				if (touch.phase == TouchPhase.BEGAN)
				{
					
				}
				else if (touch.phase == TouchPhase.HOVER)
				{
					
				}
			}
		}
		
		private function onAddedToStage(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
			m_background = new Image ( Assets.getTexture("background1"));
			m_background.pivotX = m_background.width / 2;
			m_background.pivotY =0;
			m_background.x = 1050/2;
			m_background.y = 0;
			this.addChild(m_background);
			m_text_User = new TextInput();
			m_text_User.text = "";
			m_text_User.width = 150;
			m_text_User.height = 20;
			m_text_User.x = 150;
			m_text_User.y = 150;
			m_text_User.textEditorProperties.fontFamily = "Helvetica";
			m_text_User.textEditorProperties.fontSize = 12;
			m_text_User.textEditorProperties.color = 0xffffff;
			
			m_pass_User = new TextInput();
			m_pass_User.text = "";
			m_pass_User.width = 150;
			m_pass_User.height = 20;
			m_pass_User.x = 150;
			m_pass_User.y = 180;
			m_pass_User.textEditorProperties.fontFamily = "Helvetica";
			m_pass_User.textEditorProperties.fontSize = 12;
			m_pass_User.textEditorProperties.color = 0xffffff;
			m_pass_User.displayAsPassword = true;
			
			var m_background2:Image = new Image ( Assets.getTexture("background2"));
			m_text_User.addChild(m_background2);
			m_background2.scaleX = m_text_User.width / m_background2.width;
			m_background2.scaleY = m_text_User.height / m_background2.height;
			m_background2.alpha = 0.5;
			
			var m_background3:Image = new Image ( Assets.getTexture("background2"));
			m_pass_User.addChild(m_background3);
			m_background3.scaleX = m_pass_User.width / m_background3.width;
			m_background3.scaleY = m_pass_User.height / m_background3.height;
			m_background3.alpha = 0.5;
			
			m_text_Text_User= new TextField(150, 20, "", "Helvetica", 15, 0x000000);
			m_text_Pass_User = new TextField(150, 20, "", "Helvetica", 15, 0x000000);
			
			m_text_Text_User.x = m_text_User.x-150;
			m_text_Text_User.y = m_text_User.y;
			m_text_Text_User.text = "Tên đăng nhập";

			m_text_Pass_User.x = m_pass_User.x-150;
			m_text_Pass_User.y = m_pass_User.y;
			m_text_Pass_User.text = "Mật khẩu";
			
			m_button_Login = new Button(Assets.getTexture("background2"), "");
			
			m_button_Login.x = m_pass_User.x+50;
			m_button_Login.y = m_pass_User.y+30;
			m_button_Login.width = 100;
			m_button_Login.height = 50;
			m_button_Login.addEventListener(Event.TRIGGERED, button_triggeredHandler );
			
			this.addChild(m_background);
			this.addChild( m_text_User );
			this.addChild( m_pass_User );
			this.addChild(m_text_Pass_User);
			this.addChild(m_text_Text_User);
			this.addChild(m_button_Login);
			
		}
		
		private function button_triggeredHandler(e:Event):void 
		{
			
		}
		
		private function update(e:Event):void 
		{
			
		}
	}
}